home *** CD-ROM | disk | FTP | other *** search
- Path: news.spb.su!KremlSun!glukr!glukr!not-for-mail
- From: "Igor A. Krivokon" <igor@vsi.kiev.ua>
- Newsgroups: comp.lang.c++
- Subject: Re: works in Borland but not in Microsuck Visual C++
- Date: 15 Mar 1996 16:27:13 +0200
- Organization: Private person
- Sender: news@render.gu.kiev.ua
- Distribution: world
- Message-ID: <AB-zMInOhJ@vsi.kiev.ua>
- References: <4ia6h8$jes@news.vanderbilt.edu>
- Reply-To: igor@vsi.kiev.ua
- NNTP-Posting-Host: news@render.gu.kiev.ua
- X-Return-Path: vsi!vsi.kiev.ua!igor@creator.gu.kiev.ua
-
- Bennett Haselton (haseltbt@ctrvax.vanderbilt.edu) writes:
-
- > The following program was written in completely standard C++
- >and should be portable across platforms. However, it only performs as
- >expected (i.e. sends two copies of 4 to the standard out stream) in Borland
- >C++; when compiled in MicroSUCK Visual C++, it outputs 4 followed by a random
- >integer in the thousands.
- >
- >#include <iostream.h>
- >
- >struct person {
- > int age;
- >};
- >
- >struct person* matchPerson( struct person* psnPtr )
- >{
- > struct person* ansPtr;
- > ansPtr->age = psnPtr->age;
- ^^^^^^^^^^^^^^^^^^^^^^^^^^
- You should allocate memory for object (struct) before you use it!
-
- [skipped]
-
- >
- >i was using version 1.0 of Visual C++; i have no knowledge of whether later
- >Microsuck compilers are capable of handling a program like this properly.
-
- I doubt :)
-
- >Please avoid buying their products whenever possible if you have not already
- >resolved to do so.
-
- Please avoid to judge hastily.
-
- >
- > Love,
- >
- > tm
- > -bennett
- >
-
- Yours,
-
- Igor Krivokon
-
-
-